package com.gitee.fastmybatis.core.query;

import com.gitee.fastmybatis.core.support.Getter;
import com.gitee.fastmybatis.core.util.ClassUtil;

import java.util.LinkedHashMap;
import java.util.Map;

/**
 * @author 六如
 */
public class LambdaUpdateQuery<T> extends LambdaQuery<T> {

    private static final long serialVersionUID = 6602149094502524056L;

    private final Map<String, Object> set = new LinkedHashMap<>(8);

    public static <T> LambdaUpdateQuery<T> create(Class<T> clazz) {
        return new LambdaUpdateQuery<>();
    }

    /**
     * 设置字段值
     *
     * @param getter 数据库字段
     * @param value  值
     * @return 返回自身
     */
    public LambdaUpdateQuery<T> set(Getter<T> getter, Object value) {
        set.put(ClassUtil.getColumnName(getter), value);
        return this;
    }

    public Map<String, Object> getSet() {
        return set;
    }

}
